<template>
    <div>
        <h1>房号管理--添加</h1>

        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td align="right">房号名称</td>
                    <td><input type="text" v-model="queryInfo.noName"></td>
                </tr>

                <tr>
                    <td align="right">房型</td>
                    <td>
                        <select v-model="queryInfo.houseTypeId">
                            <option :value="1">总统套房</option>
                            <option :value="2">商务型</option>
                            <option :value="3">双床房</option>
                            <option :value="4">大床房</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td align="right">房态</td>
                    <td>
                        <select v-model="queryInfo.houseState">
                            <option :value="1">空闲</option>
                            <option :value="2">已预约</option>
                            <option :value="3">已入住</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td align="right">状态</td>
                    <td>
                        <input type="radio" name="state" :value="1" v-model="queryInfo.state">上架
                        <input type="radio" name="state" :value="0" v-model="queryInfo.state">下架
                    </td>
                </tr>

                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="提交" @click="ok">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import axios from 'axios';
const router = useRouter()
const route = useRoute()


let queryInfo = reactive({
  noName: '',
  houseTypeId: 1,
  houseState: 1,
  state: 1,
})



const ok = ()=>{
    if(queryInfo.noName == ''){
        alert('房号名称不能为空');
        return;
    }
    axios({
        url:'/api/HouseNo/NoAdd',
        method:'post',
        data:queryInfo
    })
    .then(res=>{
        console.log(res);
            alert('添加成功');
            router.push('/housenolist');
    })
    .catch(err=>{
        console.log(err);
    })
}



</script>

<style scoped>
h1{
    text-align: center;
}
</style>